﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Model;
using BLL;
using System.Security.Policy;

namespace dome
{
    public partial class Login : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            //
           
        }

        protected void buttDL_Click(object sender, EventArgs e)
        {
            //一、Request.QueryString传值

            //querstring页面传值
            string url;
            url = "yonghu.aspx?name=admin";
            Response.Redirect(url);

            //var name = this.tb_name.Text;
            //var pwd = this.tb_pwd.Text;
            //var user = UserDDBLL.gatall(name, pwd);
            //if (name == null)
            //{
            //    Response.Write("<script>alert('账户不能为空')</script>");
            //}
            //if (pwd == null)
            //{
            //    Response.Write("<script>alert('不能为空')</script>");
            //}

            //    if (user.role == 0)
            //{
            //    Response.Redirect("yonghu.aspx");




            //    Server.Transfer("index.aspx");




            //}
            //else if (user.role == 1)
            //{
            //    Response.Redirect("guanliyuan.aspx");
            //}

            //cookie传值
            var name = this.tb_name.Text;
            var pwd = this.tb_pwd.Text;
            ////创建cookie对象
            HttpCookie cookie = new HttpCookie("name");
            cookie.Value = name;
            ////设置有效期30秒
            cookie.Expires = DateTime.Now.AddSeconds(30);
            ////写入客户端
            Response.Cookies.Add(cookie);
            Response.Redirect("yonghu.aspx");


            //---Application传值
            //全局变量，（例子：统计站点访问人数）
            //很少用，使用多了会消耗服务器太多资源

            //Application["name"] = tb_name.Text;
            //Response.Redirect("guanliyuan.aspx");


            //session页面传值

            //---Session传值

            //服务端，大量传值增大服务端压力

            //Session["name"] = tb_name.Text;

            //Response.Redirect("guanliyuan.aspx");



        }
    }
}